<template>
  <div class="container">
    <!-- <nav-bar title="我的粉丝" /> -->
    <!-- 搜索 -->
    <div class="search">
      <!-- <div class="search-area">
        <input type="text" :value="keywords">
        <button @click="search">搜索</button>
      </div> -->
    </div>
    <div class="total">{{myFans.length}}个{{isISP? '主理人':'粉丝'}}</div>
    <div class="list">
      <div 
        class="item" 
        v-for="(item, index) in myFans" 
        :key="index"
        @click="goToFansLife"
      >
        <img v-if="item.Photo==='' || item.Photo===null" src='../../assets/img/person.png' />
        <img v-else :src='item.Photo' />
        <div class="info">
          <div class="name">{{ item.Nick }}</div>
          <!-- <div class="time">添加时间 {{ item.CreateDate.split('T').join(' ') }}</div> -->
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import NavBar from 'components/common/NavBar'
import { getMyFans } from '../../network/belong'
import { productionDomain } from '../../config/global'

export default {
  components: {
    NavBar
  },
  data() {
    return {
      isISP: JSON.parse(localStorage.getItem('isISP')),
      keywords: '',
      myFans: [],
    }
  },
  mounted() {
    this.getMyFans()
  },
  methods: {
    search(){},
    goToFansLife(){
      // this.$router.push('/fansLife')
    },
    getMyFans(){
      getMyFans( list => {
        list.map(item => {
          if(item.Photo){
            if(item.Photo.indexOf('http') === -1){
              console.log(item.Photo)
              item.Photo = productionDomain + item.Photo
            }
          }
          return item
        })
        this.myFans = list.reverse()
      })
    },
  },
}
</script>

<style scoped>
.container{
  background-color: #fff;
}
.total{
  padding: 0 20px;
  line-height: 3;
  position: relative;
  margin-top: -15px;
  border-radius: 10px 10px 0 0;
  background-color: #ffffff;
}
.list{
  padding: 0 20px;
}
.list .item{
  display: flex;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid #e0e0e0;
}
.list .item img{
  width: 50px;
  height: 50px;
  margin-right: 20px;
  border-radius: 50%;
}
.list .item .time{
  font-size: 14px;
  padding-top: 5px;
  color: #ccc;
}
.search{
  padding: 15px 20px 30px 20px;
  /* background-color: #000000; */
}
.search-area{
  display: flex;
  justify-content: stretch;
  height: 36px;
  border-radius: 36px;
  overflow: hidden;
  border: 1px solid #e4e4e4;
  box-sizing: border-box;
  background-color: #ffffff;
}
.search-area input{
  flex-grow: 1;
  text-indent: 15px;
}
.search-area button{
  width: 100px;
  margin: 1px;
  height: 34px;
  border-radius: 34px;
  font-size: 14px;
  color: #ffffff;
  background-color: #000000;
}
</style>